package com.yixun.qfbao.hander;

import com.yixun.qfbao.api.service.ReportModelApiService;
import com.yixun.qfbao.apidto.DeleteReportModelReqDto;
import com.yixun.qfbao.apidto.DeleteReportModelResDto;
import com.yixun.qfbao.apidto.EditReportModelReqDto;
import com.yixun.qfbao.apidto.EditReportModelResDto;
import com.yixun.qfbao.dto.base.BaseRequestDTO;
import com.yixun.qfbao.dto.base.BaseResponseDTO;
import com.yixun.qfbao.hander.base.CommonAbstractHander;
import com.yixun.qfbao.vo.DeleteReportModelReqVo;
import com.yixun.qfbao.vo.EditReportModelReqVo;
import com.yixun.qfbao.xf.model.enums.ResultEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("DeleteReportModelHander")
public class DeleteReportModelHander extends CommonAbstractHander{
    private static Logger logger= LoggerFactory.getLogger(DeleteReportModelHander.class);
    @Autowired
    private ReportModelApiService reportModelApiService;

    @SuppressWarnings("rawtypes")
    @Override
    public BaseResponseDTO doBusiness(BaseRequestDTO reqDto) {
        DeleteReportModelReqVo req = (DeleteReportModelReqVo)reqDto;
        DeleteReportModelReqDto reqDto1 = req.getParams();
        BaseResponseDTO<DeleteReportModelResDto> res = new BaseResponseDTO<DeleteReportModelResDto>();
        DeleteReportModelResDto resDto = new DeleteReportModelResDto();
        try {
            resDto = reportModelApiService.deleteReportModel(reqDto1);
        } catch (Exception e) {
            logger.error("DeleteReportModelHander error: {}", e);
            resDto.setResult(ResultEnum.FAIL.getNo());
            resDto.setResultMsg("删除楼盘报备模板失败!");
        }
        res.setResData(resDto);
        res.setResult(resDto.getResult());
        return res;
    }
}
